home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Developer's Kit 1996
/
Delphi Developer's Kit 1996.iso
/
power
/
dllswd
/
maindemo.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-12-22
|
2KB
|
86 lines
unit Maindemo;
interface
uses
SysUtils, WinTypes, {WinProcs,} Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, FileCtrl, Buttons;
type
TDemoForm = class(TForm)
Button5: TButton;
QuitBtn: TBitBtn;
procedure Button1Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var DemoForm: TDemoForm;
Const PasswordLoaded : Boolean = False; { Presume nothing! }
var Mot: function: WordBool;
implementation
{$R *.DFM}
{$IFDEF WINDOWS}
uses WinProcs;
Const SEM_NoOpenFileErrorBox = $8000;
{$ELSE}
uses WinAPI;
{$ENDIF}
var SaveExit: pointer;
DLLHandle: Word;
procedure NewExit; far;
begin
ExitProc := SaveExit;
FreeLibrary(DLLHandle)
end {NewExit};
procedure TDemoForm.FormCreate(Sender: TObject);
begin
{$IFDEF WINDOWS}
SetErrorMode(SEM_NoOpenFileErrorBox);
{$ENDIF}
DLLHandle := LoadLibrary('PASSWORD.DLL');
If DLLHandle >= 32 then { Succes }
Begin
PasswordLoaded := True;
SaveExit := ExitProc;
ExitProc := @NewExit;
@Mot := GetProcAddress(DLLHandle,'MOTDEPASSE');
If not Mot
then Application.Terminate
else Begin
{ Initialization }
Color := clGreen ; { Just for the DEMO }
End ;
End else
Begin
MessageDlg('Fichier PASSWORD.DLL introuvable!', mtInformation,[mbOk], 0) ;
Application.Terminate ;
End ;
end;
procedure TDemoForm.Button1Click(Sender: TObject);
begin
Close ;
end;
procedure TDemoForm.Button5Click(Sender: TObject);
begin
If Mot
then Color := clGreen
else Color := clRed;
end;
end.